<%@ page language="java" import="java.util.*,com.hs.app.model.*,com.hs.core.utils.*,com.hs.core.cache.*" pageEncoding="utf-8"%>
<%
	String tagname = (String)request.getAttribute("tagname"); 
	List catagorytype = (List)request.getAttribute("catagorytype");
 	String tagtype = (String)request.getAttribute("tagtype");
	PageUtil pageUtil = (PageUtil)request.getAttribute("dataList");
    String pageStr = ""; 
    int perpageCount = 1;
    int currentPage = 1;
    List dataList = null;
    if(null != pageUtil){
	   dataList = pageUtil.getPageList();
	   pageStr = pageUtil.getPageStr();
	   perpageCount = pageUtil.getNumberPerPage();
	   currentPage = pageUtil.getCurrentPage();
	}  
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<%@ include file="../../include.jsp"%> 
<script src='<%=basePath%>dwr/interface/dataHelper.js'></script>  

<script language=JavaScript>
  //查询
 function searchData()
{
  	document.searchform.action="<%=basePath%>catagory/catagorylist.do?1=1";	
	document.searchform.submit();
}
//删除题录信息
 function deleteData(){
    var ids = document.getElementsByName("stdid");    
    var idstr = "";          
    for (var i = 0; i < ids.length; i++)               
    {                     
           if(ids[i].checked){
           	 idstr += ids[i].value+",";
           }            
    }    
    if(idstr == ""){
    	alert("请先选择要删除的标准数据!");
    	return;
    }else{
	 	if(confirm("确定要删除所选择的标准数据吗?")){
	 		dataHelper.deleteSta(idstr,callback4delete); 
	 	}
 	}
 }

 function callback4delete(message){
       alert('共删除'+message+"条数据!");
       document.searchform.action="<%=basePath %>standard/standardlist.do?1=1"
 	   document.searchform.submit();
 	
 }

 function exportData()
{
	document.searchform.action="<%=basePath%>standard/standardexport.do";	
  	document.searchform.submit();
}
//题录信息
 function magaInfo(id)
{
	var pageURL = "<%=basePath %>data/magainfo.do?id=" + id;
	openwindow(pageURL,'800','600','书籍信息'); 
}
function catagoryinfo(cid){
   openwindow('<%=basePath%>catagory/catagoryinfo.do?cid='+cid,'600','200','');

}
</script>
</head>
<body>
 <div class="cont"> 
                <form name="searchform" action="<%=basePath %>catagory/catagorylist.do?1=1" method="post">
                
                <table border="0" cellpadding="0" cellspacing="0" class="tableForm">
			        <tr>
			          <th width="10%">名称:</th>
			          <td width="*"><input type="text" name="rightname" value="<%=tagname==null?"":tagname %>"  style="width:80%" />
					</td>
					<th width="10%">类型:</th>
			          <td width="20%">
			            <select name="tagtype" id="tagtype" style="width:60%">
			               <option value="-1" <%if("-1".equals(tagtype)){out.println(" selected");} %>>------全部------</option> 
			            
			             <%
			             if(null != catagorytype){
			                for(int i=0;i<catagorytype.size();i++){
			                	Map data = (Map)catagorytype.get(i);
			                	String typename = (String)data.get("tagname");
			                	String typeid =  data.get("id") +"";
			                	%>
			               		<option value="<%=typeid%>" <%if(typeid.equals(tagtype)){out.println(" selected");} %>><%=typename%></option> 
			            <% } 
			            }
			           %>  
			          </select>
					</td>
			        <td width="5%">
			           <input name="" type="button" class="btn btn-primary" onclick="searchData();"  value=" 查 询 "/> </td>
			           <td width="5%"> <input onclick="catagoryinfo('');" type="button" value="新增" class="btn btn-primary"/>  </td>
			           <td width="5%"> <input onclick="selectAll(true,'stdid');" type="button" value="全选" class="btn btn-primary"/> </td>
			           <td width="5%"> <input name="" type="button" class="btn btn-primary" onclick="deleteData();" value=" 删  除 "/> </td>
	                   <td width="2%"></td>
			        </tr> 
			      </table>  
                </form>
     <div class="listWrap">
       <table border="0" cellpadding="0" cellspacing="0" class="tableList">
       <tr>
        <th width="5%">
                          选择
        </th> 
        <th width="20%">名称</th>
        <th width="20%">英文名称</th> 
        <th width="15%">类别</th> 
        <th width="20%">添加时间</th>
        <th width="*">操作</th>
      </tr>
      <%if(null != dataList&&dataList.size()>0){
      		for(int i =0;i<dataList.size();i++){
      			CdcTags tag = (CdcTags)dataList.get(i); 
      			String type = tag.getTagtype()+"";
       %>
      <tr>
        <td class="tac"><input type="checkbox" name="stdid"  id="stdid" value="<%=tag.getId() %>" /> 
        </td> 
        <td><%=tag.getTagname()%></td>
        <td><%=StringUtilTool.NULL2Blank(tag.getTagnameng())%></td>
        <td><%if("1".equals(type)){out.println("方剂");}else if("2".equals(type)){out.println("中药");}else if("3".equals(type)){out.println("组分");}%></td>
        <td class="tac"><%=StringUtilTool.NULL2Blank(tag.getImpdate()) %></td>  
        <td align="center"><a href="javaScript:catagoryinfo('<%=tag.getId()%>');">修改</a>&nbsp;&nbsp;&nbsp;<a href="#">删除</a></td>
      </tr>
      
      <%}}else{ %>
      <tr>
        <td class="tac" colspan=6><font color=red><strong>没有主题分类数据！</strong></font></td>
      </tr> 
      <%} %>
    </table>  
    
 <div class="pageWrap">
        <div class="result"></div>
        <div class="page">
              <%=pageStr %>
        </div>
    </div>
     </div>
</div>
</body>
</html>